package com.yixing.demo.controller;

import com.yixing.demo.service.MessageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@RestController
@RequestMapping("/message")
public class MessageController {
    @Resource
    MessageService messageService;

    @RequestMapping("/getmessage")
    public Object getmessage(Integer sessionId) {
      List<String> historyMessage = messageService.getSessionHistoryMessageBySessionId(sessionId);
        Collections.reverse(historyMessage);
        return historyMessage;
    }

}
